package org.smile.homework01.paladin.rocket;

public class Engines {

    String name;
    int engineNumber;

    int runningTime;
    int cdTime;
    int cding;

    String status;

    public Engines(int i){

        engineNumber = i;
        name = i + "号引擎";

        runningTime = (int)(Math.random()*10);
        cdTime = (int)(Math.random()*10);
        // 状态1为待命，2为运行中，3为冷却中
        status = "待命";
    }

    public void setStatus(String i){
        status = i;
    }

    public String getStatus(){
        return status;
    }

    public void coldDown(){
        if(cding == 0){
            status = "待命";
        }

        if(status.equals("冷却中")) {
            cding--;
            System.out.println(name + "冷却还需要" + cding + "秒");
        }

    }

    public int getRunningTime(){
        return runningTime;
    }

    public int getCdTime() {
        return cdTime;
    }

    public void setCding(int i){
        cding = i;
    }
}
